<script type="text/javascript" src="/DesktopModules/NBright/NBrightBuy/Themes/config/js/nbbajax.js"></script>
<script type="text/javascript" src="/DesktopModules/NBright/NBrightBuy/Themes/config/js/jquery.genxmlajax.js"></script>

[<tag id="resourcepath" type="meta" value="/DesktopModules/NBright/NBrightBuy/App_LocalResources/" />]
[Template:datepicker.html]

<script type="text/javascript">
    $(document).ready(function () {
        $('.box-content').toggle(); // Initially hide all panels - Doesn't hide Products in cat - need to fox
        $('.customerdetails div.box-content').toggle(); // Then open specific ones
        $('.customeractions div.box-content').toggle();
        $('.pageactions div.box-content').toggle();

        $('.customerdiscount div.box-content').toggle();

        nbxget('clientdiscountcodes', '#clientselectparams', '#clientdiscountcodes'); // load discounts

        $('#clientdiscountcodes').change(function () {
            $('.removediscountcode').click(function () { removeelement($(this).parent().parent().parent().parent()); });
            if (!Modernizr.inputtypes.date) $('input[[id*="validuntil"]]').datepicker();
        });

        $('#adddiscountcode').click(function () {
            $('input[[id*="addqty"]]').val($('input[[id*="txtadddiscountcodeqty"]]').val());
            nbxget('addclientdiscountcode', '#clientselectparams', '#clientdiscountcodes', null, 'true');
        });

        // save form with postback
        $('a[[id*="cmdSave"]]').click(function () {
            //move data to update postback field   
            $('input[[id*="xmlupdatediscountcodedata"]]').val($.fn.genxmlajaxitems('#clientdiscountcodes', '.discountcode'));
        });

        function removeelement(elementtoberemoved) {
            $(elementtoberemoved).remove(); 
        }


    });
</script>

<br/>

<!-- postback fields to keep ajax populated data for update -->
[<tag id="xmlupdatediscountcodedata" type="postback" value=""/>]

        <!-- Required: id="clientselectparams" -->
<div id="clientselectparams">
    [<tag id="portalid" type="hidden" databind="PortalId" />]
    [<tag id="userid" type="hidden" databind="UserId" />]
    [<tag id="addqty" type="hidden" value="1"/>]
    [<tag id="lang" type="currentculture" />] 
</div>

<div id="pageactionssource"><!-- Page actions are moved into header bar - also exist at page bottom-->
	<div class="col-xs-9 col-sm-9">
		<a href="#" class="show-sidebar">
		  <i class="fa fa-bars"></i>
		</a>
		<div class="actionbuttonwrapper">
			[<tag id="cmdSave" type="linkbutton" resourcekey="General.cmdSaveButton" cssclass="btn btn-primary" commandname="save" commandargument="ItemID" />]
			[<tag id="cmdReturn" type="linkbutton" resourcekey="General.cmdReturnButton" cssclass="btn btn-default" commandname="return" />]
	    </div>
	</div>
	<div class="col-xs-3 col-sm-3 top-panel-right">
		<!-- No language in this page -->
	</div>
</div>

<div class="row customerdetails">
	<div class="col-xs-12">
		<div class="box">
			<div class="box-header">
				<div class="box-name">
					<i class="fa fa-home"></i>
					<span>Customer Information</span>
				</div>
				<div class="box-icons">
					<a class="collapse-link">
						<i class="fa fa-chevron-up"></i>
					</a>
					<a class="expand-link">
						<i class="fa fa-expand"></i>
					</a>
					<a class="close-link">
						<i class="fa fa-times"></i>
					</a>
				</div>
				<div class="no-move"></div>
			</div>
			<div class="box-content">
				<div class="card">

						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblUserID" />]</label>
						<div class="col-sm-4">
							<p class="form-control-static">[<tag type='valueof' databind="ItemId" />]</p>
						</div>
						<div class="clearfix"></div>
						
						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblUserName" />]</label>
						<div class="col-sm-4">
							<p class="form-control-static">[<tag type='valueof' xpath='genxml/textbox/username' />]</p>
						</div>
						<div class="clearfix"></div>

						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblFirstName" />]</label>
						<div class="col-sm-4">
							<p class="form-control-static">[<tag type='valueof' xpath='genxml/textbox/firstname' />]</p>
						</div>
						<div class="clearfix"></div>
						
						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblLastName" />]</label>
						<div class="col-sm-4">
							<p class="form-control-static">[<tag type='valueof' xpath='genxml/textbox/lastname' />]</p>
						</div>
						<div class="clearfix"></div>

						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblDisplayName" />]</label>
						<div class="col-sm-4">
							<p class="form-control-static">[<tag type='valueof' xpath='genxml/textbox/displayname' />]</p>
						</div>
						<div class="clearfix"></div>
						
						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblauthorised" />]</label>
						<div class="col-sm-4">
						    <p class="form-control-static">
					        <i class="[<tag type='if' xpath='genxml/membership/approved' testvalue='True' display='fa fa-check-circle fa-lg' displayelse='' />]"></i>
						    </p>
						</div>
						<div class="clearfix"></div>

					<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.userlockedout" />]</label>
						<div class="col-sm-4">
						    <p class="form-control-static">
						        <i class="[<tag type='if' xpath='genxml/membership/lockedout' testvalue='True' display='fa fa-check-circle fa-lg' displayelse='' />]"></i>
						    </p>
						</div>
						<div class="clearfix"></div>

				    <label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblupdatepassword" />]</label>
						<div class="col-sm-4">
						    <p class="form-control-static">
						        <i class="[<tag type='if' xpath='genxml/membership/updatepassword' testvalue='True' display='fa fa-check-circle fa-lg' displayelse='' />]"></i>
						    </p>
						</div>
						<div class="clearfix"></div>


						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblisdeleted" />]</label>
						<div class="col-sm-4">
							<p class="form-control-static">
								<i class="[<tag type='if' xpath='genxml/textbox/isdeleted' testvalue='True' display='fa fa-check-circle fa-lg' displayelse='' />]"></i>
							</p>
						</div>
						<div class="clearfix"></div>
						
						<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Clients.lblEmail" />]</label>
						<div class="col-sm-5">
							[<tag type="textbox" cssclass="form-control" id="email" />]
						</div>
						<div class="clearfix"></div>

				</div>
				
			</div>
		</div>
	</div>
	
	
</div>


<div class="row customeractions">
	<div class="col-xs-12 col-sm-12">
		<div class="box">
			<div class="box-header">
				<div class="box-name">
					<i class="fa fa-search"></i><span>[<tag type="valueof" resourcekey="Clients.Actions" />]</span>
				</div>
				<div class="box-icons">
					<a class="collapse-link"><i class="fa fa-chevron-up"></i>
					</a><a class="expand-link"><i class="fa fa-expand"></i></a>
					<a class="close-link"><i class="fa fa-times"></i></a></div>
				<div class="no-move">
				</div>
			</div>
			<div class="box-content">
				<div class="form-horizontal dnnForm">
					<div class="col-sm col-sm-6">
					<p class="page-header">[<tag type="valueof" resourcekey="Clients.Ordering" />]</p>
					<div class="form-group">
						<div class="col-sm-4">
						[<tag id="cmdViewOrders" type="linkbutton" resourcekey="Clients.cmdViewOrders" commandname="vieworders" cssclass="btn btn-default btn-block" commandargument="ItemID" />]
						</div>
						<div class="col-sm-4">
						[<tag id="cmdCreateOrder" type="linkbutton" resourcekey="Clients.cmdCreateOrder" commandname="createorder" cssclass="btn btn-default btn-block" commandargument="ItemID" />]
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-4">
						[<tag id="cmdViewAddressBook" type="linkbutton" resourcekey="Clients.cmdViewAddressBook" commandname="viewaddressbook" cssclass="btn btn-default btn-block" commandargument="ItemID" />]
						</div>
					</div>
					</div>
					<div class="col-sm col-sm-6">
					<p class="page-header">[<tag type="valueof" resourcekey="Clients.UserAccount" />]</p>
					<div class="form-group">
						<div class="col-sm-4">
						[<tag id="cmdValidateUser" type="linkbutton" resourcekey="Clients.cmdValidateUser" commandname="validateuser" cssclass="btn btn-success btn-block" commandargument="ItemID" />]
						</div>
						<div class="col-sm-4">
						[<tag id="cmdResetPass" type="linkbutton" resourcekey="Clients.cmdResetPass" commandname="resetpass" cssclass="btn btn-warning btn-block" commandargument="ItemID" />]
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-4">
						[<tag id="cmdUnlockUser" type="linkbutton" resourcekey="Clients.cmdUnlockUser" commandname="unlockuser" cssclass="btn btn-default btn-block" commandargument="ItemID" />]
						</div>
					    <div class="col-sm-4">
					        [<tag type='if' xpath='genxml/textbox/isdeleted' testvalue='True' display='{OFF}' />]
    					        [<tag id="Tag1" type="linkbutton" resourcekey="Clients.cmdDeleteUser" commandname="deleteuser" cssclass="btn btn-warning btn-block" commandargument="ItemID" />]					        
                            [<tag type='endif' />]
					        [<tag type='if' xpath='genxml/textbox/isdeleted' testvalue='True' display='{ON}' />]
    					        [<tag id="cmdRemoveUser" type="linkbutton" resourcekey="Clients.cmdRemoveUser" commandname="removeuser" cssclass="btn btn-warning btn-block" commandargument="ItemID" />]					        
                            [<tag type='endif' />]
					    </div>
					</div>
					</div>

	<div class="clearfix">
	</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="row customerdiscount">
	<div class="col-md-12">
		<div class="box">
			<div class="box-header">
				<div class="box-name">
					<i class="fa fa-search"></i><span>[<tag type="valueof" resourcekey="General.Discount" />] / [<tag type="valueof" resourcekey="General.Voucher" />]</span>
				</div>
				<div class="box-icons">
					<a class="collapse-link"><i class="fa fa-chevron-down"></i>
					</a><a class="expand-link"><i class="fa fa-expand"></i></a>
					<a class="close-link"><i class="fa fa-times"></i></a></div>
				<div class="no-move">
				</div>
			</div>
			<div class="box-content">
			    <div class="form-horizontal dnnForm">
			        <div class="col-sm-12">
			            <div class="form-group form-inline">
			                <a class="btn btn-primary" id="adddiscountcode">[<tag type="htmlof" resourcekey="General.cmdAddButton" />]</a>
			                [<tag id="txtadddiscountcodeqty" cssclass="form-control onedigit text-center" type="textbox" maxlength="2" text="1" />]
			            </div>
			            <ul id="clientdiscountcodes"></ul>
			        </div>
			    </div>
				<div class="clearfix"></div>
			</div>
		</div>
	</div>
</div>

<div class="row customernotes">
	<div class="col-md-12">
		<div class="box">
			<div class="box-header">
				<div class="box-name">
					<i class="fa fa-search"></i><span>[<tag type="valueof" resourcekey="Clients.Notes" />]</span>
				</div>
				<div class="box-icons">
					<a class="collapse-link"><i class="fa fa-chevron-down"></i>
					</a><a class="expand-link"><i class="fa fa-expand"></i></a>
					<a class="close-link"><i class="fa fa-times"></i></a></div>
				<div class="no-move">
				</div>
			</div>
			<div class="box-content">
				<div class="form-horizontal dnnForm">
					<div class="col-md-12">
					<div class="form-group">
						<div class="col-md-12">
						<label class="control-label sr-only">[<tag type="valueof" resourcekey="Clients.Notes" />]</label>
							[<tag id="message" cssclass="form-control" type="dnn:dnntexteditor" height="400" width="100%" />]
						</div>
					</div>
			  	  	</div>
			    </div>
				<div class="clearfix"></div>
			</div>
		</div>
	</div>
</div>
